﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {




    }

    private void Draw()
    {
        HtmlCapture hc = new HtmlCapture();
        hc.HtmlImageCapture +=
           new HtmlCapture.HtmlCaptureEvent(hc_HtmlImageCapture);
        hc.Create("http://www.163.com");
        //or
       // hc.Create("http://www.codeproject.com", new Size(200, 300));
        //MSPlus.HtmlConvertImage mHCont = new MSPlus.HtmlConvertImage();


        ////设置图片的长度，如果网页的长度超过一张图片的长度时自己将其分割在多张图片中
        //mHCont.ConvertImage("http://localhost:2778/yrd_tmp_gen/Genetate.aspx", Server.MapPath("App_Data\\"), "77.jpg");
    }
    protected void Button1_DirectClick(object sender, Ext.Net.DirectEventArgs e)
    {
        var t = new Thread(Draw);
        t.SetApartmentState(ApartmentState.STA);
        t.Start();

    }

    void hc_HtmlImageCapture(object sender, Uri url, Bitmap image)
    {
        image.Save("C:/" + url.Authority + ".bmp");

        //image.Save(Server.MapPath("App_Data\\") + url.Authority + ".bmp");
    }
}